package priv.demos.demo1.solution.main;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.io.File;
import java.io.FileInputStream;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

/**
 * Created on 2017/1/11.
 */
public class GenMenuUrls {

    public static void main(String[] args) throws Exception {
        Map root = JSON.parseObject(str, Map.class);
        List<Map> list = (List) root.get("menuList");
        for (Map map : list) {
            List<Map> subMenu = (List<Map>) map.get("subMenu");
            for (Map url : subMenu) {
                System.out.println(String.format("newUrls.add(\"%s\");", url.get("menuUrl")));
            }
        }
    }


    static String str = "{\n" +
            "  \"userName\": \"chenjiawang\",\n" +
            "  \"menuList\": [\n" +
            "    {\n" +
            "      \"menuId\": 92,\n" +
            "      \"menuCode\": \"m-product-info-manage\",\n" +
            "      \"menuName\": \"产品信息管理\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 93,\n" +
            "          \"menuCode\": \"m-product-info-query\",\n" +
            "          \"menuName\": \"基本信息\",\n" +
            "          \"menuUrl\": \"/product/info/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 92,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 94,\n" +
            "          \"menuCode\": \"m-product-group-query\",\n" +
            "          \"menuName\": \"分组管理\",\n" +
            "          \"menuUrl\": \"/product/group/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 92,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 95,\n" +
            "          \"menuCode\": \"m-product-message-index\",\n" +
            "          \"menuName\": \"消息配置\",\n" +
            "          \"menuUrl\": \"/product/message/index\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 92,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 96,\n" +
            "          \"menuCode\": \"m-product-template-index\",\n" +
            "          \"menuName\": \"模板创建\",\n" +
            "          \"menuUrl\": \"/product/template/index\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 92,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 97,\n" +
            "      \"menuCode\": \"m-inst-channel-manage\",\n" +
            "      \"menuName\": \"机构渠道管理\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 98,\n" +
            "          \"menuCode\": \"m-inst_info_query\",\n" +
            "          \"menuName\": \"机构基本信息\",\n" +
            "          \"menuUrl\": \"/inst/info/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 97,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 99,\n" +
            "          \"menuCode\": \"m-inst-channel-query\",\n" +
            "          \"menuName\": \"机构渠道信息\",\n" +
            "          \"menuUrl\": \"/inst/channel/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 97,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 100,\n" +
            "          \"menuCode\": \"m-payment-channel-query\",\n" +
            "          \"menuName\": \"支付渠道信息\",\n" +
            "          \"menuUrl\": \"/payment/channel/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 97,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 101,\n" +
            "          \"menuCode\": \"m-payment-limit-query\",\n" +
            "          \"menuName\": \"渠道银行限额\",\n" +
            "          \"menuUrl\": \"/payment/limit/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 97,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 102,\n" +
            "          \"menuCode\": \"m-inst-maintain-query\",\n" +
            "          \"menuName\": \"渠道维护\",\n" +
            "          \"menuUrl\": \"/inst/maintain/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 97,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 103,\n" +
            "      \"menuCode\": \"m-assistive-conf\",\n" +
            "      \"menuName\": \"辅助配置\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 104,\n" +
            "          \"menuCode\": \"m-holiday-config\",\n" +
            "          \"menuName\": \"节假日配置\",\n" +
            "          \"menuUrl\": \"/auxiliary/holiday/config\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 103,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 115,\n" +
            "          \"menuCode\": \"m-key-value-index\",\n" +
            "          \"menuName\": \"键值对配置\",\n" +
            "          \"menuUrl\": \"/auxiliary/keyValue/index\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 103,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 105,\n" +
            "      \"menuCode\": \"m-account-manage\",\n" +
            "      \"menuName\": \"开户管理\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 106,\n" +
            "          \"menuCode\": \"m-auth-config-query\",\n" +
            "          \"menuName\": \"用户鉴权\",\n" +
            "          \"menuUrl\": \"/auth/config/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 105,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 107,\n" +
            "      \"menuCode\": \"m-announcement-manage\",\n" +
            "      \"menuName\": \"公告管理\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 108,\n" +
            "          \"menuCode\": \"m-product-notice-query\",\n" +
            "          \"menuName\": \"产品公告\",\n" +
            "          \"menuUrl\": \"/product/notice/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 107,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 109,\n" +
            "      \"menuCode\": \"m-sys-maintain\",\n" +
            "      \"menuName\": \"系统维护\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 110,\n" +
            "          \"menuCode\": \"m-bank-list-query\",\n" +
            "          \"menuName\": \"银行信息\",\n" +
            "          \"menuUrl\": \"/bank/list/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 109,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 111,\n" +
            "          \"menuCode\": \"m-system-config-query\",\n" +
            "          \"menuName\": \"系统配置\",\n" +
            "          \"menuUrl\": \"/system/config/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 109,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 112,\n" +
            "          \"menuCode\": \"m-system-cache-page\",\n" +
            "          \"menuName\": \"缓存操作\",\n" +
            "          \"menuUrl\": \"/system/cache/page\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 109,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 113,\n" +
            "          \"menuCode\": \"m-log-query\",\n" +
            "          \"menuName\": \"系统日志\",\n" +
            "          \"menuUrl\": \"/log/query\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 109,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 118,\n" +
            "      \"menuCode\": \"m-prod-info\",\n" +
            "      \"menuName\": \"产品信息[新]\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 119,\n" +
            "          \"menuCode\": \"m-prod-info-query\",\n" +
            "          \"menuName\": \"产品基本信息\",\n" +
            "          \"menuUrl\": \"/prodList\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 118,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 120,\n" +
            "          \"menuCode\": \"m-prod-group-query\",\n" +
            "          \"menuName\": \"产品组配置\",\n" +
            "          \"menuUrl\": \"/groupList\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 118,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 121,\n" +
            "          \"menuCode\": \"m-prod-review-query\",\n" +
            "          \"menuName\": \"产品发布审核\",\n" +
            "          \"menuUrl\": \"/examine\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 118,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 163,\n" +
            "          \"menuCode\": \"m-product-groupv2\",\n" +
            "          \"menuName\": \"产品分组\",\n" +
            "          \"menuUrl\": \"/sectionList\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 118,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 142,\n" +
            "      \"menuCode\": \"m-assistive-conf-new\",\n" +
            "      \"menuName\": \"辅助配置[新]\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 143,\n" +
            "          \"menuCode\": \"m-holiday-config-new\",\n" +
            "          \"menuName\": \"节假日配置\",\n" +
            "          \"menuUrl\": \"/holidayConfigv2\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 142,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 144,\n" +
            "          \"menuCode\": \"m-keyvalue-new\",\n" +
            "          \"menuName\": \"键值对配置\",\n" +
            "          \"menuUrl\": \"/keyValuev2\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 142,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 145,\n" +
            "      \"menuCode\": \"m-prod-operationv2\",\n" +
            "      \"menuName\": \"产品运营[新]\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 146,\n" +
            "          \"menuCode\": \"m-prod-noticev2\",\n" +
            "          \"menuName\": \"产品公告\",\n" +
            "          \"menuUrl\": \"/noticev2\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 145,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 147,\n" +
            "      \"menuCode\": \"m-account-managev2\",\n" +
            "      \"menuName\": \"开户管理[新]\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 148,\n" +
            "          \"menuCode\": \"m-authconfigv2\",\n" +
            "          \"menuName\": \"用户鉴权\",\n" +
            "          \"menuUrl\": \"/authConfigv2\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 147,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 153,\n" +
            "      \"menuCode\": \"m-sys-maintainv2\",\n" +
            "      \"menuName\": \"系统维护[新]\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 154,\n" +
            "          \"menuCode\": \"m-bank-list-queryv2\",\n" +
            "          \"menuName\": \"银行信息\",\n" +
            "          \"menuUrl\": \"/bankList\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 153,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 155,\n" +
            "          \"menuCode\": \"m-system-config-queryv2\",\n" +
            "          \"menuName\": \"系统配置\",\n" +
            "          \"menuUrl\": \"/systemConfig\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 153,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 156,\n" +
            "          \"menuCode\": \"m-system-cache-pagev2\",\n" +
            "          \"menuName\": \"缓存操作\",\n" +
            "          \"menuUrl\": \"/cacheOperation\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 153,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 157,\n" +
            "          \"menuCode\": \"m-log-queryv2\",\n" +
            "          \"menuName\": \"系统日志\",\n" +
            "          \"menuUrl\": \"/logList\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 153,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"menuId\": 158,\n" +
            "      \"menuCode\": \"m-inst-channel-managev2\",\n" +
            "      \"menuName\": \"机构渠道[新]\",\n" +
            "      \"menuUrl\": \"#\",\n" +
            "      \"status\": true,\n" +
            "      \"parentId\": 0,\n" +
            "      \"menuType\": false,\n" +
            "      \"subMenu\": [\n" +
            "        {\n" +
            "          \"menuId\": 162,\n" +
            "          \"menuCode\": \"m-inst-maintain-queryv2\",\n" +
            "          \"menuName\": \"渠道维护\",\n" +
            "          \"menuUrl\": \"/instMaintain\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 158,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        },\n" +
            "        {\n" +
            "          \"menuId\": 164,\n" +
            "          \"menuCode\": \"m-inst-basic-info\",\n" +
            "          \"menuName\": \"机构基本信息\",\n" +
            "          \"menuUrl\": \"/instList\",\n" +
            "          \"status\": true,\n" +
            "          \"parentId\": 158,\n" +
            "          \"menuType\": false,\n" +
            "          \"subMenu\": []\n" +
            "        }\n" +
            "      ]\n" +
            "    }\n" +
            "  ]\n" +
            "}";

}